<template>
  <rx-layout>
    <div slot="center" style>
      <rx-fit>
        <div slot="toolheader" foldheader="true" foldbtn="false" border="false">
          <div class="table-operator">
            <rx-button alias="bpmInstPermissionAdd" :butn-icon="'plus'" :butn-type="'primary'" :show-no-right="true" @click="add">
                {{$ti18('rxList.newBtn','新建')}}
            </rx-button>
            <a-dropdown v-if="editEnable && selectedRowKeys.length > 0 || removeEnable && selectedRowKeys.length > 0">
              <a-button style="margin-left: 8px">
                  {{$ti18('rxList.moreBtn','更多')}}
               <a-icon type="down" /> </a-button>
              <a-menu slot="overlay">
                <a-menu-item key="1" v-if="editEnable && selectedRowKeys.length > 0" alias="bpmInstPermissionEdit" :butn-icon="'edit'"
                             :butn-type="'primary'" :show-no-right="false" @click="editOne"><a-icon type="edit"  />
                    {{$ti18('rxList.editBtn','编辑')}}
                </a-menu-item>
                <a-menu-item key="2" v-if="removeEnable && selectedRowKeys.length > 0" alias="bpmInstPermissionDelete" :butn-icon="'delete'" :butn-type="'danger'"
                             :show-no-right="false" @click="delByIds(selectedRowKeys)"><a-icon type="delete" />
                    {{$ti18('rxList.delBtn','删除')}}
                </a-menu-item>
              </a-menu>
            </a-dropdown>
          </div>
          <span class="search-btn-box">
                <span class="search-btn" @click="searchshow"><i class="iconfont iconguolv"></i>
                    {{$ti18('rxList.leachBtn','过滤')}}
                </span>
           </span>
        </div>
        <div slot="searchbar" btnalign="right"  v-if="fitSearch" @search="search" @cancel="cancel" @close="close">
          <a-form layout="vertical">
                <a-form-item :label="i18n('form.application','应用ID')">
                    <a-input :placeholder="i18n('form.application','应用ID','input')" v-model="queryParam.Q_APP_ID__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.authorId','授权人ID')">
                    <a-input :placeholder="i18n('form.authorId','授权人ID','input')" v-model="queryParam.Q_AUTH_ID__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.authorName','授权人名称')">
                    <a-input :placeholder="i18n('form.authorName','授权人名称','input')" v-model="queryParam.Q_AUTH_NAME__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.company','所属公司ID')">
                    <a-input :placeholder="i18n('form.company','所属公司ID','input')" v-model="queryParam.Q_COMPANY_ID__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.definitionID','流程定义ID')">
                    <a-input :placeholder="i18n('form.definitionID','流程定义ID','input')" v-model="queryParam.Q_DEF_ID__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.definitionKEY','流程定义KEY')">
                    <a-input :placeholder="i18n('form.definitionKEY','流程定义KEY','input')" v-model="queryParam.Q_DEF_KEY__S_LK"/>
                </a-form-item>
                <a-form-item :label="$ti18('rxForm.notes','备注')">
                    <a-input :placeholder="$ti18('rxForm.notes','备注','','input')" v-model="queryParam.Q_DESC__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.instance','实例ID')">
                    <a-input :placeholder="i18n('form.instance','实例ID','input')" v-model="queryParam.Q_INST_ID__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.delete','是否删除')">
                    <a-input :placeholder="i18n('form.delete','是否删除','input')" v-model="queryParam.Q_IS_DELETE__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.status','状态')">
                    <a-input :placeholder="i18n('form.status','状态','input')" v-model="queryParam.Q_STATUS__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.name','标题')">
                    <a-input :placeholder="i18n('form.name','标题','input')" v-model="queryParam.Q_SUBJECT__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.task','任务ID')">
                    <a-input :placeholder="i18n('form.task','任务ID','input')" v-model="queryParam.Q_TASK_ID__S_LK"/>
                </a-form-item>
                <a-form-item :label="$ti18('rxForm.type', '类型')">
                    <a-input :placeholder="$ti18('rxForm.type', '类型','','input')" v-model="queryParam.Q_TYPE__S_LK"/>
                </a-form-item>
          </a-form>
        </div>
        <rx-grid
                ref="table"
                :allowRowSelect="true"
                :multiSelect="true"
                :columns="columns"
                :defaultPageSize="10"
                url="/api-bpm/bpm/core/bpmInstPermission/query"
                :queryParam="queryParam"
                data-field="result.data"
                :pageSizeOptions="['10','30','40']"
                id-field="id"
                @selectChange="onSelectChange"
        >
        </rx-grid>
      </rx-fit>
    </div>
  </rx-layout>
</template>

<script>
  import BpmInstPermissionApi from '@/api/bpm/core/bpmInstPermission'
  import BpmInstPermissionEdit from './BpmInstPermissionEdit'
  import {BaseList,RxFit,RxGrid } from '@lowcode/jpaas-common-lib';
  export default {
    name: 'BpmInstPermissionList',
    mixins: [BaseList],
    components: {
      RxFit
    },
    data() {
      return {
        columns: [
          {
            title: this.$ti18('rxList.index','序号'),
            type: 'indexColumn',
            width: 100,
            dataIndex: 'serial',
            scopedSlots: {customRender: 'serial'}
          },
          {title: this.i18n('form.application','应用ID'), dataIndex: 'appId', width: 100},
          {title: this.i18n('form.authorId','授权人ID'), dataIndex: 'authId', width: 100},
          {title: this.i18n('form.authorName','授权人名称'), dataIndex: 'authName', width: 100},
          {title: this.i18n('form.company','所属公司ID'), dataIndex: 'companyId', width: 100},
          {title: this.i18n('form.definitionID','流程定义ID'), dataIndex: 'defId', width: 100},
          {title: this.i18n('form.definitionKEY','流程定义KEY'), dataIndex: 'defKey', width: 100},
          {title: this.$ti18('rxForm.notes','备注'), dataIndex: 'desc', width: 100},
          {title: this.i18n('form.instance','实例ID'), dataIndex: 'instId', width: 100},
          {title: this.i18n('form.delete','是否删除'), dataIndex: 'isDelete', width: 100},
          {title: this.i18n('form.status','状态'), dataIndex: 'status', width: 100},
          {title: this.i18n('form.name','标题'), dataIndex: 'subject', width: 100},
          {title: this.i18n('form.task','任务ID'), dataIndex: 'taskId', width: 100},
          {title: this.$ti18('rxForm.type', '类型'), dataIndex: 'type', width: 100},
          {title: this.$ti18("rxList.action","操作"), width: 100, dataIndex: 'action', scopedSlots: {customRender: 'action'}}
        ],
        component:BpmInstPermissionEdit,
        comment: this.i18n('list.comment','流程实例权限表'),
        widthHeight:['800px','600px'],
        fitSearch:false,
      }
    },
    methods:{
        i18n(name, text, key) {
            return this.$ti18(name, text, "BpmInstPermission", key);
        },
      delById(ids){
        return BpmInstPermissionApi.del({ ids: ids.join(',') });
      },
      getListByParams(parameter){
        return BpmInstPermissionApi.query(parameter)
      }

    }
  }
</script>
<style scoped>

</style>

